//
//  Operation.h
//  alotOf
//
//  Created by Mac_Black_Mini on 2025/9/1.
//链接操作类

#import <Foundation/Foundation.h>
#import "VPNConfigInfo.h"
#import "Node+CoreDataClass.h"
NS_ASSUME_NONNULL_BEGIN
typedef void (^SuccessBlock)(bool);

typedef NS_OPTIONS(NSUInteger, ConnectState) {
    ConnectStateDisconnect,
    ConnectStateConnecting,
    ConnectStateConnected
};

@interface LinkOperation : NSObject

@property(nonatomic, copy)SuccessBlock successBlock;

/// 节点列表
@property (nonatomic, strong, readonly) NSArray <Node *>*nodes;

/// 链接状态
@property (nonatomic, assign, readonly) ConnectState connectState;
/// 记录当前选择的节点
@property (nonatomic, strong, readonly) Node *selectNode;

//@property (nonatomic, strong) VPNConfigInfo *config;
/// 是否是vip
@property (nonatomic, assign, readonly) BOOL isVip;
/// 会员到期日期
@property (nonatomic, strong, readonly) NSDate *expirationDate;

/// 会话 ID 每次程序启动创建
@property (nonatomic, copy, readonly) NSString *sessionId;
/// 点链接的时间
@property (nonatomic, assign, readonly) NSTimeInterval startConnectTime;
/// 程序启动时间
@property (nonatomic, assign, readonly) NSTimeInterval sessionStartTime;
/// 网络类型
@property (nonatomic, copy, readonly) NSString *netType;
/// 运营商名称
@property (nonatomic, copy, readonly) NSString *carrierName;


- (VPNConfigInfo *)getConfig;


+ (instancetype)shared;
//链接vpn
-(void)linkVPNwithConfiginfo;
-(void)sotpVPN;
@end

NS_ASSUME_NONNULL_END
